﻿$(document).ready(function() {
    $("#Day").datepicker({ dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true });
    $("#FirstDay").datepicker({ dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true });
    $("#LastDay").datepicker({ dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true });

    SetupHasDetails();
    SetupIsRecurrent();

    $("#HasDetailList").click(function() {
        SetupHasDetails();
    });

    $("#IsRecurrent").click(function() {
        SetupIsRecurrent();
    });
});

function SetupHasDetails() {
    if ($("#HasDetailList").attr("checked")) {
        $("#value").hide();
        $("#category").hide();
    }
    else {
        $("#value").show();
        $("#category").show();
    }
}

function SetupIsRecurrent() {
    if ($("#IsRecurrent").attr("checked")) {
        $("#recurrentDetails").show();
    }
    else {
        $("#recurrentDetails").hide();
    }
}